Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

248
Vistas
How to have Django *not* parse "{{variable}}" when using Jsrender?

I am building a Django template which will use jsrender in order to build out dynamic Javascript templates for html code.

However, I find that when I put a Jsrender template in my code, Django flips out because Django parses anything between {{ and }} as a variable, and Jsrender uses this for its own variables. For instance, a template in Jsrender might look like:

    <script id="headerTemplate" type="text/x-jsrender">
        <h1>{{:label}}</h1>
    </script>

Django sees {{:label}} and tries to parse it, which leads to an error.

Is there a Django block I can invoke which would make Django not parse any text within it? Or otherwise to escape a { character?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can choose alternative delimiters in JsRender, so as to avoid the conflict with Django delimiters.

https://www.jsviews.com/#settings/delimiters

For example:

$.views.settings.delimiters("<%", "%>");

will change the tag syntax to <%...%>.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can turn on the {% verbatim %} … {% endverbatim %} template tag [Django-doc]:

{% verbatim %}
    <script id="headerTemplate" type="text/x-jsrender">
        <h1>{{:label}}</h1>
    </script>
{% endverbatim %}

This will thus render the double curly brackets, not interpret these.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda